@extends('admin.layout')
@section('title',$title)
@section('content')
    <meta name="_token" content="{{ csrf_token() }}"/>
    {{--<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.js"></script>--}}
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                修改管理
                <small>这是商品修改页</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 商品修改</a></li>
            </ol>
            @if (session('error'))
                <div class="alert alert-danger alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <h4><i class="icon fa fa-ban"></i> 警告!</h4>
                    <li>{{ session('error') }}</li>
                </div>
            @endif
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">商品修改</h3>
                        </div><!-- /.box-header -->
                        <!-- 添加商品表单 -->
                        <form role="form" action="/admin/goods/update" method="post" enctype="multipart/form-data">
                            {{ csrf_field() }}
                            <div class="box-body">
                                {{--<div style="float:left">--}}
                                <input type="hidden" name="id" value="{{$data[0] -> id}}">
                                <input type="hidden" name="category_id" value="{{$data[0] -> category_id}}">
                                <input type="hidden" name="oldpic" value="{{$data[0] -> goods_pic}}">
                                <label for="exampleInputEmail1" style="float:left">商品分类:&nbsp;&nbsp;</label>
                                <div class="form-group" style="width:20%;float:left">
                                    <select class="form-control"  name="">

                                            <option>商品分类</option>
                                        @foreach($cate as $v)
                                            <option
                                                    @if(($data[0] -> category_id) == ($v -> id))
                                                            selected
                                                    @endif value="{{$v -> id}}">{{$v -> catename}}</option>
                                        @endforeach
                                    </select>

                                </div>


                                <div class="form-group">
                                    <br><br><br>
                                    <label for="exampleInputEmail1" style="float:left">商品名称:&nbsp;&nbsp;</label>
                                    <input type="text" name="goods_name" class="form-control" id="exampleInputEmail1" placeholder="请输入商品名称" style="width:60%" value="{{$data[0] -> goods_name}}">
                                </div>


                                <div class="form-inline">
                                    <label for="exampleInputEmail1">商品品牌:&nbsp;</label>
                                    <select class="form-control" name="brand" style="width:30%">
                                        <option>{{$data[0] -> brand}}</option>

                                    </select>
                                </div><br>

                                <div class="form-group">
                                    <label for="exampleInputEmail1">商品状态:&nbsp;</label>
                                    <label>

                                        立即上架:<input type="radio" name="status" class="flat-red" value="1">
                                        立即下架:<input type="radio" name="status" class="flat-red" value="0">
                                    </label>

                                </div>

                                <div class="form-inline">
                                    <label for="exampleInputEmail1">京东价格:&nbsp;</label>
                                    <input type="text" name="price" class="form-control" id="exampleInputEmail1" placeholder="0.00元" style="width:30% " value="{{$data[0] -> price}}">
                                </div><br>
                                <div class="form-inline">
                                    <label for="exampleInputEmail1">商品库存:&nbsp;</label>
                                    <input type="text" name="num" class="form-control" id="exampleInputEmail1" placeholder="请输入正确商品规格" style="width:30%" value="{{$data[0] -> num }}">
                                </div><br>


                                <label for="exampleInputFile">商品主图:</label>
                                <input type="file" name="goods_pic" id="exampleInputFile">

                                <img src="{{$data[0] -> goods_pic}}"><br>
                                <label for="exampleInputFile">商品详情:</label>
                                <!-- 加载编辑器的容器 -->
                                <script id="container" name="describe" type="text/plain" style="width:100%;height:300px;" >{!!$data[0] -> describe!!}</script>
                                <!-- 配置文件 -->
                                <script type="text/javascript" src="{{asset('/ue/ueditor.config.js')}}"></script>
                                <!-- 编辑器源码文件 -->
                                <script type="text/javascript" src="{{asset('/ue/ueditor.all.js')}}"></script>
                                <!-- 实例化编辑器 -->
                                <script type="text/javascript">
                                    var ue = UE.getEditor('container');
                                </script>


                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-danger">确认更新</button>
                            </div>
                        </form>
                    </div><!-- /.box -->






                </div><!--/.col (left) -->
                <!-- right column -->

            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection
